/*
  ==============================================================================

    This file contains the basic framework code for a JUCE plugin editor.

  ==============================================================================
*/

#pragma once

#include "DialLookAndFeel.h"
#include "CustomComponents.h"
#include "PluginProcessor.h"
#include "StyledComponent.h"
#include <JuceHeader.h>

#define TOP_COMPONENT_HEIGHT 500
#define TOP_COMPONENT_WIDTH 694
#define TOP_BOX_HEIGHT 470
#define TOP_BOX_WIDTH 658
#define LOGO_BOX_WIDTH 294
#define LOGO_BOX_HEIGHT 84
#define SEPERATE_WIDTH 17
#define IR_LABEL_WIDTH 350
#define IR_BUTTON_WIDTH 50
#define IR_BYPASS_LABEL_WIDTH 80

using SliderAttachment = juce::AudioProcessorValueTreeState::SliderAttachment;

//==============================================================================
/**
 */
class Dist_ampAudioProcessorEditor : public juce::AudioProcessorEditor,
                                     public juce::Timer {
public:
    Dist_ampAudioProcessorEditor(Dist_ampAudioProcessor&);
    ~Dist_ampAudioProcessorEditor() override;

    //==============================================================================
    void paint(juce::Graphics&) override;
    void resized() override;
    void timerCallback() override;

private:
    // This reference is provided as a quick way for your editor to
    // access the processor object that created it.
    Dist_ampAudioProcessor& audioProcessor;

    std::shared_ptr<juce::Slider> gainKnob;
    std::shared_ptr<juce::Label> gainLabel;
    std::unique_ptr<SliderAttachment> gainValue;

    std::shared_ptr<juce::ToggleButton> boostButton;
    std::shared_ptr<juce::Label> boostLabel;

    std::shared_ptr<juce::ToggleButton> channelSelectButton;
    std::shared_ptr<juce::Label> channelSelectLabel;
    std::shared_ptr<juce::RoundLED> channel1Led;
    std::shared_ptr<juce::RoundLED> channel2Led;
    std::shared_ptr<juce::Label> channel1LedLabel;
    std::shared_ptr<juce::Label> channel2LedLabel;

    std::shared_ptr<juce::Slider> presenceKnob;
    std::shared_ptr<juce::Label> presenceLabel;
    std::unique_ptr<SliderAttachment> presenceValue;

    std::shared_ptr<juce::Slider> bassKnob;
    std::shared_ptr<juce::Label> bassLabel;
    std::unique_ptr<SliderAttachment> bassValue;

    std::shared_ptr<juce::Slider> midKnob;
    std::shared_ptr<juce::Label> midLabel;
    std::unique_ptr<SliderAttachment> midValue;

    std::shared_ptr<juce::Slider> trebleKnob;
    std::shared_ptr<juce::Label> trebleLabel;
    std::unique_ptr<SliderAttachment> trebleValue;

    std::shared_ptr<juce::Slider> masterKnob;
    std::shared_ptr<juce::Label> masterLabel;
    std::unique_ptr<SliderAttachment> masterValue;

    std::shared_ptr<juce::FileChooser> irFileChooser;
    std::shared_ptr<juce::Label> irLabel;
    std::shared_ptr<juce::TextButton> irButton;
    std::shared_ptr<juce::String> irFile;
    std::shared_ptr<juce::ToggleButton> irBypassButton;
    std::shared_ptr<juce::Label> irBypassLabel;

    std::shared_ptr<juce::LevelMeter> levelMeterIn;
    std::shared_ptr<juce::Label> inputLevelLabel;
    std::shared_ptr<juce::Slider> inputKnob;
    std::unique_ptr<SliderAttachment> inputValue;
    std::shared_ptr<juce::LevelAlarm> levelAlarmIn;

    std::shared_ptr<juce::LevelMeter> levelMeterOut;
    std::shared_ptr<juce::Label> outputLevelLabel;
    std::shared_ptr<juce::Slider> outputKnob;
    std::unique_ptr<SliderAttachment> outputValue;
    std::shared_ptr<juce::LevelAlarm> levelAlarmOut;

    DialLookAndFeel dialLookAndFeel;
    StyledComponent topComponent;

    void irButtonClicked();

    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Dist_ampAudioProcessorEditor)
};
